<template>
  <div class="return-button" :style="{ height: capsuleHeight + 'px', top: capsuleTop + 'px' }" @click="handleReturn">
    <div>返回</div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { goBack } from '@/utils/utils'
const capsuleTop = ref(0)
const capsuleHeight = ref(0)
const handleReturn = () => {
  goBack()
}
onMounted(() => {
  const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
  capsuleHeight.value = menuButtonInfo.height
  capsuleTop.value = menuButtonInfo.top
  console.log('返回')
})

</script>

<style lang="scss">
.return-button {
  position: fixed;
  left: 20rpx;
  z-index: 101;
  display: flex;
  align-items: center;
}
</style>
